package com.gss.armory.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.gss.common.util.ApplicationMaps;
import com.gss.common.util.ApplicationUtilities;

@Entity
@Table(name="DOCUMENT_CUSTODIAN_DETAILS")
public class DocumentCustodianDetailsDTO implements Serializable {

	private long vaultId;
	private long docId;
	private String docName;
	private String vaultLocation;
	private String vaultNumber;
	private String custodianName;
	private String custodianId;
	private String custodianDesig;
	private Long custodianLocId;
	private Long custodianDepttId;
	private String custodianLocName;
	private String custodianDepttName;
	

	@Id
	@Column(name="DCD_VAULT_ID")
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getVaultId() {
		return vaultId;
	}
	@Column(name="DCD_DOC_ID")
	public long getDocId() {
		return docId;
	}
	@Column(name="DCD_VAULT_NUMBER")
	public String getVaultNumber() {
		return vaultNumber;
	}
	@Column(name="DCD_CUSTODIAN_NAME")
	public String getCustodianName() {
		return custodianName;
	}
	@Column(name="DCD_CUSTODIAN_ID")
	public String getCustodianId() {
		return custodianId;
	}
	@Column(name="DCD_CUSTODIAN_DESIGNATION")
	public String getCustodianDesig() {
		return custodianDesig;
	}
	@Column(name="DCD_CUSTODIAN_LOCATION_ID")
	public Long getCustodianLocId() {
		return custodianLocId;
	}
	@Column(name="DCD_CUSTODIAN_DEPTT_ID")
	public Long getCustodianDepttId() {
		return custodianDepttId;
	}
	public void setDocId(long docId) {
		this.docId = docId;
		if(ApplicationUtilities.checkIfNullOrBlank(docName))
			setDocName(ApplicationMaps.DOCUMENT_ID_NAME_MAP.get(this.docId));
	}
	public void setVaultNumber(String vaultNumber) {
		this.vaultNumber = vaultNumber;
	}
	public void setCustodianName(String custodianName) {
		this.custodianName = custodianName;
	}
	public void setCustodianId(String custodianId) {
		this.custodianId = custodianId;
	}
	public void setCustodianDesig(String custodianDesig) {
		this.custodianDesig = custodianDesig;
	}
	public void setCustodianLocId(Long custodianLocId) {
		this.custodianLocId =  custodianLocId;
		if(ApplicationUtilities.checkIfNullOrBlank(custodianLocName))
			setCustodianLocName(ApplicationMaps.LOCID_LOCNAME_MAP.get(this.custodianLocId));
	}
	public void setCustodianDepttId(Long custodianDepttId) {
		this.custodianDepttId = custodianDepttId;
		if(ApplicationUtilities.checkIfNullOrBlank(custodianDepttName))
			setCustodianDepttName(ApplicationMaps.DEPTID_DEPTSNAME_MAP.get(this.custodianDepttId));
	}

	public void setVaultId(long vaultId) {
		this.vaultId = vaultId;
	}
	@Transient
	public String getCustodianLocName() {
		return custodianLocName;
	}
	@Transient
	public String getCustodianDepttName() {
		return custodianDepttName;
	}
	public void setCustodianLocName(String custodianLocName) {
		this.custodianLocName = custodianLocName;
	}
	public void setCustodianDepttName(String custodianDepttName) {
		this.custodianDepttName = custodianDepttName;
	}
	@Column(name="DCD_CUSTODIAN_LOCATION")
	public String getVaultLocation() {
		return vaultLocation;
	}
	public void setVaultLocation(String vaultLocation) {
		this.vaultLocation = vaultLocation;
	}
	
	@Transient
	public String getDocName() {
		return docName;
	}
	public void setDocName(String docName) {
		this.docName = docName;
	}
}
